package com.qk.ezbuy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qk.ezbuy.dao.UserAddressMapper;
import com.qk.ezbuy.pojo.News;
import com.qk.ezbuy.pojo.UserAddress;
import com.qk.ezbuy.service.UserAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserAddressServiceImpl implements UserAddressService {

    @Autowired
    private UserAddressMapper userAddressMapper;

    @Override
    public int insertSelective(UserAddress record) {
        return userAddressMapper.insertSelective(record);
    }

    @Override
    public PageInfo<UserAddress> selectPage(int pageNum, int pageSize, int userid) {
        PageHelper.startPage(pageNum,pageSize);
        List<UserAddress> list = userAddressMapper.selectByUserId(userid);
        PageInfo<UserAddress> pageInfo = new PageInfo<UserAddress>(list);
        return pageInfo;
    }

    @Override
    public int updateByPrimaryKeySelective(UserAddress record) {
        return userAddressMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public UserAddress selectByUserAddressId(int id) {
        return userAddressMapper.selectByUserAddressId(id);
    }

    @Override
    public int delUserAddressById(UserAddress userAddress) {
        return userAddressMapper.delUserAddressById(userAddress);
    }

    @Override
    public List<UserAddress> selectAll(Integer userid) {
        return userAddressMapper.selectAll(userid);
    }

    @Override
    public List<UserAddress> selectUserAddressById(int userid) {
        return userAddressMapper.selectUserAddressById(userid);
    }

    @Override
    public UserAddress selectUserAddressByisDefault(int userid) {
        return userAddressMapper.selectUserAddressByisDefault(userid);
    }


}
